{% extends "dash/base_dash.html" %}

{% load dash_filters %}

{% block menuOptions %}
{% if user.persona %}
<li class="active"><a href="{% url 'dashboard' %}">Dashboard</a></li>
<li><a href="{% url 'logbook' %}">Logbook</a></li>
{% else %}
<li><a href="{% url 'dash_empresa' %}">Dashboard</a></li>
<li><a href="{% url 'dash_planes' %}">Planes</a></li>
{% endif %}
{% endblock menuOptions %}

{% block dashboard %}
    <div class="row">
        <div id="filter-content" class="dashboard-list-topics">
            <ul class="list-topics">
                {% for topic in r_topics %}
                    <li>
                        {% if topic in user.persona.topicos.all %}
                            <a href="/dash/dashboard/{{ topic.id }}">
                                <div class="list-item-topico list-item-topico-{{ topic|unicode|split:" "|first|lower }}" title="{{ topic|unicode|split:" "|first }}"></div>
                            </a>
                        {% else %}
                            <a href="/dash/dashboard/topic/add/{{ topic.id }}">
                                <div class="list-item-topico un-list-item-topico-{{ topic|unicode|split:" "|first|lower }}" title="{{ topic|unicode|split:" "|first }}"></div>
                            </a>
                        {% endif %}
                    </li>
                {% endfor %}
                <li>
                    {% if all_topics %}
                        <a href="/dash/dashboard/all">
                            <div class="list-item-topico list-item-topico-all" title="Todos"></div>
                        </a>
                    {% else %}
                        <a href="/dash/dashboard/all">
                            <div class="list-item-topico un-list-item-topico-all" title="Todos"></div>
                        </a>
                    {% endif %}
                </li>
            </ul>
        </div>
    </div>
    <div class="row">
        {% for items in topicos %}
            {% for item in items %}
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-md-2">
                            <div class="item-topico item-topico-{{ item.topico|unicode|split:" "|first|lower }}" title="{{ item.topico|unicode|split:" "|first }}"></div>
                        </div>
                        <div class="col-md-8"><a href="{% url 'item-detail' item.pk %}">{{ item }}</a></div>
                        <div class="col-md-2">
                            <img src="{{ STATIC_URL }}images/dashboard-content-item-header-score.png" alt="Score" title="Cantidad de fans">
                            <span>{{ item.cantidad_fans_from_qs }}</span>
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-md-3">
                            <div class="thumbnail" title="Imagen ilustrativa del item">
                            {% if item.mis_imagenes.count %}
                                <img id="imagen_grande" src="{{ item.first_image_big }}" alt="Score">
                            {% else %}
                                <img src="{{ STATIC_URL }}images/298.png" alt="Score">
                            {% endif %}
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="well" title="Descripcion del item">{{ item.descripcion }}</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">
                    <div class="row">
                        <div class="col-md-2">{{ item.topico }}</div>
                        <div class="col-md-offset-6 col-md-4">
                            {% if user.is_active %}
                                {% if user.persona %}
                                    {% if not is_fan %}
                                        <a href="/items/fan/{{ item.id }}" title="Hazte Fan de este item"><img src="{{ STATIC_URL }}images/item-button-fan.png" alt="Fan" /></a>
                                    {% endif %}
                                    <a href="/items/recomendation/{{ item.id }}" title="Recomendá este item a tus seguidores"><img src="{{ STATIC_URL }}images/item-button-recomendar.png" alt="Recomendar" /></a>
                                    {% if mostrar_denuncia %}
                                        <a href="/items/denunciar_item/{{ item.id }}" ><img src="{{ STATIC_URL }}images/item-button-denunciar.png" alt="Denunciar" /></a>
                                    {% endif %}
                                    {% if is_fan %}
                                        <a href="/items/unfan/{{ item.id }}" ><img src="{{ STATIC_URL }}images/item-buttom-unFan.png" alt="Unfan" /></a>
                                    {% endif %}
                                {% else %}
                                    {% if mostrar_boton_enlace %}
                                        <a href="/bussiness/registrar_enlace/{{ item.id }}"><img src="{{ STATIC_URL }}images/item-button-registrar-enlace.png" alt="Registrar Enlace" /></a>
                                    {% endif %}
                                {% endif%}
                            {% endif %}
                        </div>
                    </div>
                </div>
            </div>
            {% endfor %}
        {% endfor %}
    </div>
{% endblock dashboard %}


{% block sidebar %}
    {% include "dash/sidebar.html" %}
{% endblock sidebar %}

{% block footer %}
    {% include "dash/footer.html" %}
{% endblock%}
